<?php

defined('ROOT_PATH')
    || define('ROOT_PATH', realpath(dirname(__FILE__) . '/..'));

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

//define('APPLICATION_ENV', "production");
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

defined('LIBRARY_PATH')
    || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library'));

//define('APPLICATION_ENV', 'production');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    realpath(APPLICATION_PATH . '/../../Library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Ext.php';
/** Zend_Application */
require_once 'Zend/Application.php';  


// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application.ini'
);

/*
$view = new Zend_View();
$view->addBasePath(TEMPLATES_PATH . '/default')
     ->addBasePath(TEMPLATES_PATH . '/admin');
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$layout = Zend_Layout::startMvc(array('layoutPath' => TEMPLATES_PATH . '/layouts/'));
*/

// 开发环境下打开自动加载警告
if ('production' !== APPLICATION_ENV) {
    $application->getAutoloader()->suppressNotFoundWarnings(false);
}

/*
// 我们仅加载 frontController 资源
$application->getBootstrap()->bootstrap('FrontController');
$application->run();
*/


$application->bootstrap()
            ->run();


            
            